<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f() {
            var val = document.getElementById('a');
            var split = val.value.split(",");
            var i=0;
            var mycars=new Array()
            var b=0;
            while (i <= split.length) {
                if (split[i]%2==0){
                    mycars[b++]=split[i];
                }
                i++;
            }
            alert(mycars)
        }
    </script>
</head>
<body>
<span onclick=this.style.fontWeight="bold">找出数组中的偶数，返回新数组</span>
<br>
字符串数组格式:(2,3,1,3,6):<input type="text" value="" id="a">
<input type="button" value="开始查找" onclick="f()">
</body>
</html>